package com.qianbao.qianbaobusiness.ui.mine.storeinfo;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.androidbase.widget.recycleadpter.BaseRecycleViewAdapter;
import com.qianbao.qianbaobusiness.R;
import com.qianbao.qianbaobusiness.json.StoreInfoBean;

/**
 * @author: Routee
 * @date 2018/6/20
 * @mail wangc4@qianbaocard.com
 * ------------1.本类由Routee开发,阅读、修改时请勿随意修改代码排版格式后提交到git。
 * ------------2.阅读本类时，发现不合理请及时指正.
 * ------------3.如需在本类内部进行修改,请先联系Routee,若未经同意修改此类后造成损失本人概不负责。
 */
class StoreInfoRvAdapter extends BaseRecycleViewAdapter<StoreInfoBean.MerchantListBean> {

    public StoreInfoRvAdapter(Context context) {
        super(context);
    }

    @Override
    protected void onBindBaseViewHolder(RecyclerView.ViewHolder holder, StoreInfoBean.MerchantListBean bean) {
        VH vh = (VH) holder;
        vh.mTvNames.setText(bean.getMerchantname());
        vh.mTvTime.setText(bean.getOpentime().replaceAll(",", "-"));
        vh.mTvContact.setText(bean.getMobile());
        vh.mTvAddress.setText(bean.getProvinceName() + bean.getCityName() + bean.getAreaName() + bean.getAddress());
    }

    @Override
    protected RecyclerView.ViewHolder onCreateBaseViewHolder(ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(mContext).inflate(R.layout.item_store_info, null);
        return new VH(view);
    }

    @Override
    protected int getBaseItemViewType(int position) {
        return 0;
    }

    class VH extends RecyclerView.ViewHolder {

        TextView mTvNames;
        TextView mTvTime;
        TextView mTvContact;
        TextView mTvAddress;

        public VH(View itemView) {
            super(itemView);
            mTvNames = itemView.findViewById(R.id.tv_names);
            mTvTime = itemView.findViewById(R.id.tv_time);
            mTvContact = itemView.findViewById(R.id.tv_contact);
            mTvAddress = itemView.findViewById(R.id.tv_address);
        }
    }
}

